﻿using System;
using System.Collections.Generic;
using System.Text;
using DreamShield.Deployment.Installers.DreamPlugins;

namespace DreamShield.Deployment.Miles
{
    /// <summary>
    /// Serveur de plugins, point d'attache de tout les plugins Miles
    /// </summary>
    public class MilesRootServer : BaseDreamPluginServer
    {
        /// <summary>
        /// Construit une instance du serveur de plugin Miles
        /// </summary>
        /// <param name="engine"></param>
        public MilesRootServer(DreamPluginsEngine engine)
            : base(engine)
        {
        }

        /// <summary>
        /// Enregistre un plugin Miles. Devrait être Appelé lors de l'initialisation
        /// du servuer (MilesPlugin.ServerInitialized)
        /// </summary>
        /// <param name="plugin"></param>
        public virtual void RegisterPlugin(IMilesPlugin plugin)
        {
            if (plugin == null)
                throw new ArgumentNullException("plugin");

            base.AddRegisteredModel(plugin.NativePluginType, plugin.NativePluginImplementation);
        }
    }
}
